<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>知了课堂-celery实战</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" src="/static/js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>

    <link rel="stylesheet" href="/static/sweetalert/sweetalert.css">
    <script src="/static/sweetalert/sweetalert.min.js"></script>
    <script src="/static/sweetalert/task_alert.js"></script>
</head>

<body>
<div class="x-nav">

    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <xblock>
        <span class="x-right" style="line-height:40px">共有数据：{{ count }} 条</span>
    </xblock>
    <table class="layui-table">
        {% csrf_token %}
        <thead>
        <tr>
            <th>ID</th>
            <th>执行结果</th>
            <th>运行时间</th>

        </thead>
        <tbody>

        {% for cron_log in  cron_logs %}
            <tr>
                <td>{{ forloop.counter }}</td>
                <td>{{ cron_log.status }}</td>
                <td>{{ cron_log.user_time }}</td>

            </tr>
        {% endfor %}


        </tbody>
    </table>
    <div class="page">
        <div>
            {#上一页#}
            {% if page_obj.has_previous %}
                <a class="prev"
                   href="{% url 'task_config:config_log_list' %}?p={{ page_obj.previous_page_number }}"><<</a>
            {% else %}
                <a class="prev" href="javascript:void(0);" style="cursor: not-allowed"><<</a>
            {% endif %}
            {% if left_has_more %}
                <a class="prev" href="{% url 'task_config:config_log_list' %}?p=1">1</a>
                <a class="prev" href="javascript:void(0);">...</a>
            {% endif %}

            {# 左边的页码 #}
            {% for left_page in left_pages %}
                <a class="num" href="{% url 'task_config:config_log_list' %}?p={{ left_page }}">{{ left_page }}</a>
            {% endfor %}
            {# 当前的页码#}
            <span class="current">{{ current_page }}</span>
            {#<a href="{% url 'menu_manage:menu_list' %}?p={{ current_page }}" class="current">{{ current_page }}</a>#}

            {# 右边的页码 #}
            {% for right_page in right_pages %}
                <a class="num" href="{% url 'task_config:config_log_list' %}?p={{ right_page }}">{{ right_page }}</a>
            {% endfor %}

            {% if right_has_more %}
                <a class="num" href="javascript:void(0);">...</a>
                <a class="num" href="{% url 'task_config:config_log_list' %}?p={{ num_pages }}">{{ num_pages }}</a>
            {% endif %}
            {#下一页#}
            {% if page_obj.has_next %}
                <a class="next" href="{% url 'task_config:config_log_list' %}?p={{ page_obj.next_page_number }}">&gt;&gt;</a>
            {% else %}
                <a class="disabled next" href="javascript:void(0);" style="cursor: not-allowed">&gt;&gt;</a>
            {% endif %}


        </div>
    </div>

</div>
<script>

    /*用户-停用*/
    function member_stop(obj, id) {
        var x = $(obj).attr('title') ? '启用' : '停用'
        var message = '确定要' + x + '么？'
        layer.confirm(message, function (index) {

            if ($(obj).attr('title') === '启用') {

                //发异步把用户状态进行更改
                $(obj).attr('title', '停用')
                $(obj).find('i').html('&#xe62f;');

                $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                layer.msg('已停用!', {icon: 5, time: 1000});

            } else {
                $(obj).attr('title', '启用')
                $(obj).find('i').html('&#xe601;');

                $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
                layer.msg('已启用!', {icon: 5, time: 1000});
            }

        });
    }

    /*用户-删除*/
    function member_del(obj, id) {
        layer.confirm('确认要删除吗？', function (index) {
            //发异步删除数据
            $(obj).parents("tr").remove();
            layer.msg('已删除!', {icon: 1, time: 1000});
        });
    }


    function delAll(argument) {

        var data = tableCheck.getData();

        layer.confirm('确认要删除吗？' + data, function (index) {
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
    }
</script>

<script src="/static/js/task_conf.js"></script>
</body>

</html>
